/* 
 * File:   AcptEpoll.h
 * Author: kisme
 *
 * Created on 03 January 2013, 3:06 PM
 */

#ifndef ACPTEPOLL_H
#define	ACPTEPOLL_H

// epoll ...
#include <sys/epoll.h>
// write()...
#include <unistd.h>
#include "AcptBase.h"

/**
 * Configure area
 */
struct Conf_AcptEpoll : public Conf_AcptBase {
    // max listen fd num
    int maxEpollSize;
    // max trigger info size
    int maxInfoSize;
    // server's event
    struct epoll_event event;
    // epoll fd
    int epollfd;
    // a switch of server
    int onoff;
    
    Conf_AcptEpoll();
};

/**
 * coming connect's info
 */
struct Info_Coming {
    struct sockaddr_in client_addr;
    socklen_t client_len;
    
    Info_Coming();
};

/**
 * Kisme : AcptEpoll
 */
class AcptEpoll : public AcptBase {
public:
    AcptEpoll();
    AcptEpoll(const AcptEpoll& orig);
    virtual ~AcptEpoll();
    //----------//
    /**
     * configure self
     * @param aSockFd
     * @return 
     */
    int config(const int aSockFd);
    int ready();
    int listen();
    int turn(const int aOnOff);
private:
    /**
     * configure instance
     */
    struct Conf_AcptEpoll *mConf;
};

#endif	/* ACPTEPOLL_H */

